

const batchAddSubTemplate = 'batchAddSub';
const batchAddSubTaleTemplate = 'batchAddSubTaleTemplate';

export default function(to) {
    const {
        step,
        currentFormValue
    } = this.state;

    const {
        form: {
            getAllFormValue,
            setFormStatus,
            setAllFormValue
        }
    } = this.props;

    if(step === 1 && to === 2) {
        this.setState({
            currentFormValue: getAllFormValue(batchAddSubTemplate)
        }, () => {
            this.getTableData();
        });
    }
    if(step === 2 && to === 1) {
        this.setState({
            step: 1
        }, () => {
            setAllFormValue({
                [batchAddSubTemplate]: currentFormValue
            });
            setFormStatus(batchAddSubTemplate, 'edit');
        });
    }
}
